<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/common/taglib.jsp" %>    
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>

	<script>
		//# sourceURL=personForm.js
		
		function submitSuccess() {
		 	//alert("hello: " + $("#personForm").serialize());
			$.post("${ctx}/org/person/${actionName}.action",
				$("#personForm").serialize(),
				function(data, status){
					if (data == 'success') {
						dialogSubmitSuccess();
						return;
					} else {
						alert("错误: \n" + data);
					}
				}
			).success(function() { 
				//alert("submitForm success"); 
			})
			.error(function(xmlHttpRequest, textStatus, errorThrown) { 
				  alert("异常： " + xmlHttpRequest.status + ":" + errorThrown);
			})
			.complete(function() { 
				//alert("submitForm complete"); 
			});	

		}
	</script>

</head>

<body>

<div class="modal-header">
	<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
		&times;
	</button>
	<h4 class="modal-title">
		<c:choose>
			<c:when test="${actionName == 'add'}">新建人员</c:when>
			<c:otherwise>修改人员</c:otherwise>
		</c:choose>		
	</h4>
</div>

<div class="modal-body">
	<form:form modelAttribute="person" id="personForm" class="form-horizontal" role="form" method="post">

		<form:hidden path="personId"/>
		<form:hidden path="orgId"/>
		
		<fieldset disabled>
			<div class="form-group">
				<label for="orgPath" class="col-sm-2 control-label">主岗</label>
				<div class="col-sm-10">
					<form:input path="orgPath" class="form-control"/>
				</div>
			</div>
		</fieldset>

		<div class="form-group">
			<label for="loginName" class="col-sm-2 control-label">*登录名</label>
			<div class="col-sm-10">
				<form:input path="loginName" class="form-control"/>
			</div>
		</div>
		<div class="form-group">
			<label for="name" class="col-sm-2 control-label">*姓名</label>
			<div class="col-sm-10">
				<form:input path="name" class="form-control"/>
			</div>
		</div>		
		<div class="form-group">
			<label for="code" class="col-sm-2 control-label">编码</label>
			<div class="col-sm-10">
				<form:input path="code" class="form-control"/>
			</div>
		</div>
		<div class="form-group">
			<label for="sex" class="col-sm-2 control-label">性别</label>
			<div class="col-sm-10">
<%-- 				<form:input path="sex" class="form-control"/> --%>
				<form:select path="sex" class="form-control">
		           <form:option value=""></form:option>
		           <form:option value="男">男</form:option>
		           <form:option value="女">女</form:option>
		        </form:select>
			</div>
		</div>		
		<div class="form-group">
			<label for="birthday" class="col-sm-2 control-label">生日</label>
			<div class="col-sm-10">
				<form:input path="birthday" class="form-control"/>
			</div>
		</div>
		<div class="form-group">
			<label for="email" class="col-sm-2 control-label">*邮箱</label>
			<div class="col-sm-10">
				<form:input path="email" class="form-control"/>
			</div>
		</div>			
		<div class="form-group">
			<label for="mobile" class="col-sm-2 control-label">手机</label>
			<div class="col-sm-10">
				<form:input path="mobile" class="form-control"/>
			</div>
		</div>		
		<div class="form-group">
			<label for="description" class="col-sm-2 control-label">描述</label>
			<div class="col-sm-10">
				<form:input path="description" class="form-control"/>
			</div>
		</div>

	</form:form>
</div>

<div class="modal-footer">
	<button type="button" class="btn btn-primary" onclick="submitSuccess();">确定</button>
	<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>	
</div>
   	
</body>
</html>